/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Matrimonial;

import Login.MySqlConnector;
import java.sql.Connection;
import java.sql.PreparedStatement;
/**
 *
 * @author Bharath
 */
public class MarRegisterDao {

    MySqlConnector ms = new MySqlConnector();
    private boolean b;
    private Connection con;
    private PreparedStatement ps;
    private String query;
    /* bean strings */
    private String regid;
    private String memid;
    private String matchfor;
    private String mname;
    private String msname;
    private String mgen;
    private String mdob;
    private String mage;
    private String mstat;
    private String mht;
    private String religion;
    private String mcaste;
    private String mlang;
    private String btype;
    private String complex;
    private String self_desc;
    private String madd;
    private String mcountry;
    private String mstate;
    private String mdist;
    private String mcity;
    private String morg;
    private String mqual;
    private String mprof;
    private String memail;
    private String mmob;
    private String msal;
    private String regdate;

    public boolean insert(MarRegisterBean rbean) {
        try {
            con = ms.Connect();
            regid = rbean.getRegid();
            memid = rbean.getMemid();
            matchfor = rbean.getMatchfor();
            mname = rbean.getMname();
            msname = rbean.getMsname();
            mgen = rbean.getMgen();
            mdob = rbean.getMdob();
            mage = rbean.getMage();
            mstat = rbean.getMstat() ;
            mht = rbean.getMht();
            religion = rbean.getReligion();
            mcaste = rbean.getMcaste();
            mlang = rbean.getMlang();
            btype = rbean.getBtype();
            complex = rbean.getComplex();
            self_desc = rbean.getSelf_desc();
            madd = rbean.getMadd();
            mcountry = rbean.getMcountry();
            mstate = rbean.getMstate();
            mdist = rbean.getMdist();
            mcity = rbean.getMcity();
            morg = rbean.getMorg();
            mqual = rbean.getMqual();
            mprof = rbean.getMprof();
            memail = rbean.getMemail();
            mmob = rbean.getMmob();
            msal = rbean.getMsal();
            regdate = rbean.getRegdate();
            

            query = " insert into mar_reg values(null,'"+memid+"','"+matchfor+"','"+mname+"','"+msname+"','"+mgen+"','"+mdob+"','"+mage+"'" +
                    ",'"+mstat+"','"+mht+"','"+religion+"','"+mcaste+"','"+mlang+"' , '"+btype+"','"+complex+"'" +
                    ",'"+self_desc+"','"+madd+"','"+mcountry+"','"+mstate+"','"+mdist+"','"+mcity+"','"+morg+"'" +
                    ",'"+mqual+"','"+mprof+"','"+memail+"','"+mmob+"','"+msal+"','"+regdate+"')" ;
                    System.out.println("Q="+query);
            ps = con.prepareStatement(query);
            int i = ps.executeUpdate();
           System.out.print("sql query is : "+ query);
           if(i == 1)
           {
               return true;
           }
          
        }catch (Exception ex) {
            ex.printStackTrace();
        }
        return false;
    
    }
}
